Skip to content

test(schema): pin offline-validation errors and AttributeKind values - #1523

Merged
saltas888 merged 1 commit into
stablefrom
pha/INBOX-129
Nov 13, 2026
Merged

saltas888 merged 1 commit into
stablefrom
pha/INBOX-129

Conversation

@saltas888

@saltas888 saltas888 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Why

PR #1135 added the offline schema validator tests. Its review left two threads open (AttributeKind test, error-message assertions):

  • Five tests in tests/unit/test_schema_offline_validation.py asserted any("<field>" in message for message in result.messages). These pass as long as some message mentions the field, so a changed message text or an extra error does not fail them. The reviewer asked for "only 1 error and it should be possible to assert more, or all, of its text".
  • test_attribute_kind_enum_present_without_deprecated_string_member repeated the parametrized enum test because AttributeKind was missing from its table.

Tracked as INBOX-129 in the Engineering Inbox.

What changed

Test code only. The validator and the generated models are unchanged.

  • test_schema_offline_validation.py:
    • The Jinja2, TransformPython, choice-color and relationship-cardinality tests assert the full list of messages.
    • test_out_of_enum_value_is_rejected_naming_field_and_value asserts exactly one error, its field, the received value, the reason and the rendered message. For the two literal enums (relationship kind and cardinality) the expected reason is the whole reason. For the attribute and computed-attribute kind discriminators, it is the part that names the rejected tag. Pydantic then lists every accepted tag in the order of the generated union. That list is not pinned, so regenerating the union in a different order does not break the test.
  • test_schema_generated_models.py: AttributeKind is an entry of _EXPECTED_ENUM_VALUES with its full member list, which does not include String. The separate test is removed.

How to test

uv run pytest tests/unit/test_schema_generated_models.py tests/unit/test_schema_offline_validation.py

112 passed. Full unit suite: 3,148 passed, 2 skipped, 1 xfailed, the same as on stable. invoke format, ruff, ty, mypy, yamllint, rumdl and invoke docs-validate pass. Vale is not installed on the machine that ran the checks, so the docs style check did not run. The diff changes no documentation.

To check that the tests now detect message changes, (received: was changed to (got: in infrahub_sdk/schema/validate.py. The two modules then fail 10 tests on this branch and 2 on stable.

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…teKind into the enum table

The schema tests added by #1135 checked validator errors with
`any("<field>" in message ...)`. That passes as long as some message
mentions the field, so a changed message text or an extra error does
not fail the suite. Each of those tests now asserts exactly one error
with its full message, or its field, reason and received value.

The separate AttributeKind test checked only that "Text" is present and
"String" is absent. AttributeKind is now an entry of the parametrized
enum table, which also pins the member order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@saltas888
saltas888 requested a review from a team as a code owner November 13, 2026 03:05
@saltas888 saltas888 added type/tech-debt Item we know we need to improve way it is implemented ci/skip-changelog Don't include this PR in the changelog labels Nov 13, 2026
@saltas888 saltas888 changed the title test(schema): assert exact offline-validation errors and fold AttributeKind into the enum table test(schema): pin offline-validation errors and AttributeKind values Nov 13, 2026
@saltas888

Copy link
Copy Markdown
Contributor Author

🤖 platform-health-agent · PR opened, waiting for CI and human review · 2026-11-13

details

Card: INBOX-129 (Engineering Inbox). The agent does not merge; a human reviews and merges.

History (newest first):

  • 2026-11-13: opened from pha/INBOX-129 on stable; local unit suite, format, lint and docs-validate pass.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

View guided diff | Turn on auto-fix | Re-trigger cubic

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 745be3f
Status: ✅  Deploy successful!
Preview URL: https://20de3fae.infrahub-sdk-python.pages.dev
Branch Preview URL: https://pha-inbox-129.infrahub-sdk-python.pages.dev

View logs

@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@           Coverage Diff           @@
##           stable    #1523   +/-   ##
=======================================
  Coverage   87.88%   87.88%           
=======================================
  Files         157      157           
  Lines       15660    15660           
  Branches     2114     2114           
=======================================
  Hits        13763    13763           
  Misses       1336     1336           
  Partials      561      561           
Flag Coverage Δ
integration-tests 42.95% <ø> (ø)
python-3.10 63.03% <ø> (-0.02%) ⬇️
python-3.11 63.05% <ø> (+0.01%) ⬆️
python-3.12 63.05% <ø> (ø)
python-3.13 63.05% <ø> (ø)
python-3.14 63.05% <ø> (ø)
python-3.15 63.04% <ø> (-0.02%) ⬇️
python-filler-3.12 23.03% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@saltas888
saltas888 merged commit de2c8a9 into stable Nov 13, 2026
32 checks passed
@saltas888
saltas888 deleted the pha/INBOX-129 branch November 13, 2026 12:06
polmichel added a commit that referenced this pull request Nov 16, 2026
* test(schema): assert exact offline-validation errors and fold AttributeKind into the enum table (#1523)

The schema tests added by #1135 checked validator errors with
`any("<field>" in message ...)`. That passes as long as some message
mentions the field, so a changed message text or an extra error does
not fail the suite. Each of those tests now asserts exactly one error
with its full message, or its field, reason and received value.

The separate AttributeKind test checked only that "Text" is present and
"String" is absent. AttributeKind is now an entry of the parametrized
enum table, which also pins the member order.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* chore(speckit): upgrade Spec Kit to 1.2.5 and opsmill-speckit to 1.4.1 (#1490)

* chore(lint): exclude the vendored spec-kit scripts from ruff and ty

The agent-context extension that Spec Kit 1.2 ships contains Python that
does not follow the project's rules. `.specify` is in the ruff and ty
exclude lists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(speckit): upgrade Spec Kit to 1.2.5 and opsmill-speckit to 1.4.1

Follows the "Upgrading spec-kit to 1.2 or later" steps of opsmill-speckit
v1.4.1, as in opsmill/infrahub#11376:

- remove the review extension, which does not install on Spec Kit 1.x
- upgrade the Claude integration to Spec Kit 1.2.5
- reinstall opsmill from the v1.4.1 tag
- add the checkpoint extension and the critique-opsmill preset
- replace the infrahub Jira preset with jira-branch, and delete
  dev/spec-kit/presets/infrahub
- update agent-context to 1.0.2, the version Spec Kit 1.2.5 ships, and
  keep its CLAUDE.md configuration

No file that the integration manages had local changes, so the forced
upgrade loses nothing.

Also deletes the command files that Spec Kit 0.x generated in
.agents/commands. Spec Kit 1.2 uses the skills in .agents/skills instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(speckit): replace the infrahub branch hook with the git extension's

The infrahub extension, added in #979, ran speckit.infrahub.feature
before each specification to check the Jira reference in the branch
name. Its command file was removed with the infrahub preset, so the hook
pointed to a command that no longer exists. The jira-branch preset now
does that check in speckit.git.feature, so the hook is the git
extension's, as in opsmill/infrahub#11376.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(lint): exclude the spec-kit presets from rumdl

The upgrade installs presets in .specify/presets, which rumdl checked,
unlike .specify/extensions and .specify/templates. Spec Kit regenerates
these files on each upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(speckit): run the spec-kit scripts with the project's Python

The plan, tasks and template scripts of Spec Kit 1.2 need PyYAML, which
the system python3 often lacks. The Claude Code and Codex hooks that
opsmill-speckit 1.4.1 ships point them at the project environment when it
has PyYAML, and do nothing otherwise.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X9ZEsTmHy1shuNRt88HiUb

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* test(schema): align merged dropdown choice cases with exact-error assertions

develop (#1523) switched OutOfEnumCase to expected_input/expected_reason and
asserted exact messages; infrahub-develop (e5d1ed6) added a dropdown-choice-state
case with the old invalid_value field and made the choices fixture a Dropdown
attribute. Port the new case to the new fields and expect Dropdown in the
choice color message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Saltaferis Dimitrios <d.saltaferis@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: infrahub-github-bot-app[bot] <190746546+infrahub-github-bot-app[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/skip-changelog Don't include this PR in the changelog type/tech-debt Item we know we need to improve way it is implemented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant